package com.sgb.kjwl.di.business;

import com.sgb.kjwl.repository.DeviceRepertory;
import com.sgb.kjwl.repository.impl.DeviceRepertoryImpl;
import com.sgb.kjwl.view.ui.activity.business.AddMemberActivity;
import com.sgb.kjwl.view.ui.activity.business.MemberDetailActivity;
import com.sgb.kjwl.view.ui.activity.business.MemberListActivity;
import com.sgb.kjwl.viewmodel.business.AddMemberModel;
import com.sgb.kjwl.viewmodel.business.MemberDetailModel;
import com.sgb.kjwl.viewmodel.business.MemberListModel;
import com.swgk.core.base.api.BaseApiSource;
import com.swgk.core.base.di.Activity;
import com.swgk.core.base.model.preference.BasePreferenceSource;

import dagger.Module;
import dagger.Provides;

@Module
public class BusinessModule {

    private MemberListActivity memberListActivity;
    private AddMemberActivity addMemberActivity;
    private MemberDetailActivity memberDetailActivity;

    public BusinessModule(MemberListActivity memberListActivity) {
        this.memberListActivity = memberListActivity;
    }

    public BusinessModule(AddMemberActivity addMemberActivity) {
        this.addMemberActivity = addMemberActivity;
    }

    public BusinessModule(MemberDetailActivity memberDetailActivity) {
        this.memberDetailActivity = memberDetailActivity;
    }

    @Provides
    @Activity
    DeviceRepertory provideDeviceRepertory(BaseApiSource apiSource, BasePreferenceSource preferenceSource) {
        return new DeviceRepertoryImpl(apiSource, preferenceSource) {
        };
    }

    @Provides
    @Activity
    MemberListModel provideMemberListModel(DeviceRepertory repertory) {
        return new MemberListModel(memberListActivity, repertory);
    }

    @Provides
    @Activity
    AddMemberModel provideAddMemberModel(DeviceRepertory repertory) {
        return new AddMemberModel(addMemberActivity, repertory);
    }

    @Provides
    @Activity
    MemberDetailModel provideMemberDetailModel(DeviceRepertory repertory) {
        return new MemberDetailModel(memberDetailActivity, repertory);
    }

}
